package com.neusoft.ysu.populationmanagement.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.neusoft.ysu.populationmanagement.vo.VFloPop;
import com.neusoft.ysu.populationmanagement.vo.VImpPop;
import com.neusoft.ysu.populationmanagement.vo.VResPop;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author 作者：赵子鉴
 * @since 2024-06-18
 */
@Data
public class Population implements Serializable {
    public Population(){}
    public Population(VResPop vResPop) {
        this.id = vResPop.getId();
        this.name = vResPop.getName();
        this.idnum = vResPop.getIdnum();
        this.birthday = vResPop.getBirthday();
        this.genderId = vResPop.getGenderId();
        this.nationId = vResPop.getNationId();
        this.bloodId = vResPop.getBloodId();
        this.eduId = vResPop.getEduId();
        this.marryId = vResPop.getMarryId();
        this.disabilityId = vResPop.getDisabilityId();
        this.militaryId = vResPop.getMilitaryId();
        this.popTypeId = vResPop.getPopTypeId();
        this.address = vResPop.getAddress();
        this.isDelete = vResPop.getIsDelete();
    }
    public Population(VImpPop vImpPop) {
        this.id = vImpPop.getId();
        this.name = vImpPop.getName();
        this.idnum = vImpPop.getIdnum();
        this.birthday = vImpPop.getBirthday();
        this.genderId = vImpPop.getGenderId();
        this.nationId = vImpPop.getNationId();
        this.bloodId = vImpPop.getBloodId();
        this.eduId = vImpPop.getEduId();
        this.marryId = vImpPop.getMarryId();
        this.disabilityId = vImpPop.getDisabilityId();
        this.militaryId = vImpPop.getMilitaryId();
        this.popTypeId = vImpPop.getPopTypeId();
        this.address = vImpPop.getAddress();
        this.isDelete = vImpPop.getIsDelete();
    }
    public Population(VFloPop vFloPop) {
        this.id = vFloPop.getId();
        this.name = vFloPop.getName();
        this.idnum = vFloPop.getIdnum();
        this.birthday = vFloPop.getBirthday();
        this.genderId = vFloPop.getGenderId();
        this.nationId = vFloPop.getNationId();
        this.bloodId = vFloPop.getBloodId();
        this.eduId = vFloPop.getEduId();
        this.marryId = vFloPop.getMarryId();
        this.disabilityId = vFloPop.getDisabilityId();
        this.militaryId = vFloPop.getMilitaryId();
        this.popTypeId = vFloPop.getPopTypeId();
        this.address = vFloPop.getAddress();
        this.isDelete = vFloPop.getIsDelete();
    }

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private String name;

    private String idnum;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private LocalDate birthday;

    private Integer genderId;

    private Long nationId;

    private Long bloodId;

    private Long eduId;

    private Long marryId;

    private Long disabilityId;

    private Long militaryId;

    private Long popTypeId;

    private String address;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private Integer isDelete;

    @Override
    public String toString() {
        return "Population{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", idnum='" + idnum + '\'' +
                ", birthday=" + birthday +
                ", genderId=" + genderId +
                ", nationId=" + nationId +
                ", bloodId=" + bloodId +
                ", eduId=" + eduId +
                ", marryId=" + marryId +
                ", disabilityId=" + disabilityId +
                ", militaryId=" + militaryId +
                ", popTypeId=" + popTypeId +
                ", address='" + address + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", isDelete=" + isDelete +
                '}'+"\n";
    }
}
